package com.xiweicheng.test.jpa;
// Generated 2018-7-14 9:20:43 by Hibernate Tools 5.0.6.Final

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

/**
 * Chat generated by hbm2java
 */
@Entity
@Table(name = "chat", catalog = "tms")
public class Chat implements java.io.Serializable {

	private Long id;
	private long version;
	private Users usersByUpdater;
	private Users usersByCreator;
	private String content;
	private Date createDate;
	private Boolean openEdit;
	private Boolean privated;
	private String status;
	private String title;
	private String type;
	private Date updateDate;
	private String voteCai;
	private Integer voteCaiCnt;
	private String voteZan;
	private Integer voteZanCnt;
	private Set<Users> userses = new HashSet<Users>(0);
	private Set<ChatAt> chatAts = new HashSet<ChatAt>(0);
	private Set<ChatStow> chatStows = new HashSet<ChatStow>(0);
	private Set<Label> labels = new HashSet<Label>(0);

	public Chat() {
	}

	public Chat(String status) {
		this.status = status;
	}

	public Chat(Users usersByUpdater, Users usersByCreator, String content, Date createDate, Boolean openEdit,
			Boolean privated, String status, String title, String type, Date updateDate, String voteCai,
			Integer voteCaiCnt, String voteZan, Integer voteZanCnt, Set<Users> userses, Set<ChatAt> chatAts,
			Set<ChatStow> chatStows, Set<Label> labels) {
		this.usersByUpdater = usersByUpdater;
		this.usersByCreator = usersByCreator;
		this.content = content;
		this.createDate = createDate;
		this.openEdit = openEdit;
		this.privated = privated;
		this.status = status;
		this.title = title;
		this.type = type;
		this.updateDate = updateDate;
		this.voteCai = voteCai;
		this.voteCaiCnt = voteCaiCnt;
		this.voteZan = voteZan;
		this.voteZanCnt = voteZanCnt;
		this.userses = userses;
		this.chatAts = chatAts;
		this.chatStows = chatStows;
		this.labels = labels;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Version
	@Column(name = "version", nullable = false)
	public long getVersion() {
		return this.version;
	}

	public void setVersion(long version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "updater")
	public Users getUsersByUpdater() {
		return this.usersByUpdater;
	}

	public void setUsersByUpdater(Users usersByUpdater) {
		this.usersByUpdater = usersByUpdater;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creator")
	public Users getUsersByCreator() {
		return this.usersByCreator;
	}

	public void setUsersByCreator(Users usersByCreator) {
		this.usersByCreator = usersByCreator;
	}

	@Column(name = "content")
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", length = 19)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "open_edit")
	public Boolean getOpenEdit() {
		return this.openEdit;
	}

	public void setOpenEdit(Boolean openEdit) {
		this.openEdit = openEdit;
	}

	@Column(name = "privated")
	public Boolean getPrivated() {
		return this.privated;
	}

	public void setPrivated(Boolean privated) {
		this.privated = privated;
	}

	@Column(name = "status", nullable = false)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "title")
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "type")
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_date", length = 19)
	public Date getUpdateDate() {
		return this.updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	@Column(name = "vote_cai")
	public String getVoteCai() {
		return this.voteCai;
	}

	public void setVoteCai(String voteCai) {
		this.voteCai = voteCai;
	}

	@Column(name = "vote_cai_cnt")
	public Integer getVoteCaiCnt() {
		return this.voteCaiCnt;
	}

	public void setVoteCaiCnt(Integer voteCaiCnt) {
		this.voteCaiCnt = voteCaiCnt;
	}

	@Column(name = "vote_zan")
	public String getVoteZan() {
		return this.voteZan;
	}

	public void setVoteZan(String voteZan) {
		this.voteZan = voteZan;
	}

	@Column(name = "vote_zan_cnt")
	public Integer getVoteZanCnt() {
		return this.voteZanCnt;
	}

	public void setVoteZanCnt(Integer voteZanCnt) {
		this.voteZanCnt = voteZanCnt;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "voter_chat", catalog = "tms", joinColumns = {
			@JoinColumn(name = "chat_id", nullable = false, updatable = false) }, inverseJoinColumns = {
					@JoinColumn(name = "user_id", nullable = false, updatable = false) })
	public Set<Users> getUserses() {
		return this.userses;
	}

	public void setUserses(Set<Users> userses) {
		this.userses = userses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "chat")
	public Set<ChatAt> getChatAts() {
		return this.chatAts;
	}

	public void setChatAts(Set<ChatAt> chatAts) {
		this.chatAts = chatAts;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "chat")
	public Set<ChatStow> getChatStows() {
		return this.chatStows;
	}

	public void setChatStows(Set<ChatStow> chatStows) {
		this.chatStows = chatStows;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "chat")
	public Set<Label> getLabels() {
		return this.labels;
	}

	public void setLabels(Set<Label> labels) {
		this.labels = labels;
	}

}
